/// FileName: awesome_recommend_gallery
/// Author: admin
/// Date: 2021-07-30 16:15
/// Description:

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:high_help_apps/common/values/define.dart';
import 'normal_divider.dart';

class AwesomeRecommendGallery extends StatelessWidget {
  AwesomeRecommendGallery(
      {this.galleryTitle,
      required this.builder,
      required this.length,
      this.eachHeight,
      this.isScrollable});

  /// 数据构建函数
  final builderFunction builder;

  /// 数据集的大小
  final int length;

  /// 表格的标题
  final String? galleryTitle;

  /// 每一个项的固定高度
  final double? eachHeight;

  /// 是否可以滑动
  final bool? isScrollable;

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          this.galleryTitle != null
              ? Container(
                  margin: EdgeInsets.fromLTRB(15.0.r, 15.0.r, 0, 15.0.r),
                  child: Text(
                    this.galleryTitle ?? '',
                    style: TextStyle(
                        fontSize: 18.0.sp, fontWeight: FontWeight.bold),
                  ),
                )
              : Container(),
          ListView.separated(
            shrinkWrap: true,
            physics: isScrollable == null
                ? NeverScrollableScrollPhysics()
                : BouncingScrollPhysics(),
            itemCount: this.length,
            itemBuilder: this.builder,
            separatorBuilder: (BuildContext context, int index) {
              return NormalDivider();
            },
          )
        ],
      ),
    );
  }
}
